Glasgow | Jan-26 | Fattouma Ouannassi | Sprint 2 | Coursework#967
Glasgow | Jan-26 | Fattouma Ouannassi | Sprint 2 | Coursework#967FAprogrammerO wants to merge 5 commits intoCodeYourFuture:mainfrom
Conversation
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function sum(a, b) { | ||
| return; |
There was a problem hiding this comment.
You have two "return" calls within a function. That's a syntax error.
You should write the fix for this function in the block below
There was a problem hiding this comment.
Thanks for pointing that out! I had an extra return in an earlier version, but it has been removed in the latest commit. The current function contains only one return statement.
|
|
||
| // =============> write your explanation here | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here |
There was a problem hiding this comment.
Fix for the function should be after this line
There was a problem hiding this comment.
It is indeed after the line, I just updated the comment above and then added the function below according to the instructions.
| .padEnd(2, "0"); | ||
|
|
||
| return `£${pounds}.${pence}`; | ||
| } No newline at end of file |
There was a problem hiding this comment.
You should call this function a number of times to check it works for different inputs
| // =============> write your answer here | ||
| // =============> "00" | ||
|
|
||
| // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer |
| // =============> write your answer here | ||
| // =============> num=1 | ||
|
|
||
| // e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer |
| } | ||
|
|
||
|
|
||
| const currentOutput = formatAs12HourClock("08:00"); |
There was a problem hiding this comment.
Could you test this formatAs12HourClock function at other times and see if it works?
It looks like your function only works when for "08:00", it doesn't work for other times
Test PM time, Noon and midnight
There was a problem hiding this comment.
Thank you so much for your time and your effort in reviewing my PR, Could you please update the label to "complete" when you have a moment ?
calling the function number of times to check it works for different inputs.
Adding the explanations to the answers.
testing this formatAs12HourClock function at other times
Learners, PR Template
Self checklist
Changelist
This project (sprint 2) focuses on learning how to use JavaScript methods.
Questions
/